# 定义雷达目标
from typing import Tuple
import numpy as np
from apps.fmcw.conf.app_config import AppConfig as AF

class IraTarget(object):


    def __init__(self):
        self.name = 'apps.fmcw.core.ira_target.IraTarget'

    def step(times:np.ndarray) -> Tuple[np.ndarray, np.ndarray]:
        AF.tar1_loc[:, 0] = AF.r1[0] + AF.v1_x * times
        AF.tar2_loc[:, 0] = AF.r2[0] + AF.v2_x * times
        AF.tar1_loc[:, 1] = AF.r1[1] + AF.v1_y * times
        AF.tar2_loc[:, 1] = AF.r2[1] + AF.v2_y * times
        AF.ranges_[0] = np.sqrt(AF.tar1_loc[-1][0]**2 + AF.tar1_loc[-1][1]**2 + AF.tar1_loc[-1][2]**2)
        AF.ranges_[1] = np.sqrt(AF.tar2_loc[-1][0]**2 + AF.tar2_loc[-1][1]**2 + AF.tar2_loc[-1][2]**2)
        return AF.tar1_loc, AF.tar2_loc, AF.ranges_, AF.velocitys, AF.thetas
